<template>
  <svg aria-hidden="true" :style="getStyle">
    <use :xlink:href="symbolId" />
  </svg>
</template>

<script setup lang="ts">
import { computed } from 'vue';

const props = defineProps({
  prefix: {
    type: String,
    default: 'icon',
  },
  name: {
    type: String,
    required: true,
  },
  size: {
    type: [Number, String],
    default: 16,
  }
})
const symbolId = computed(() => `#${props.prefix}-${props.name}`);
const getStyle = computed(() => {
  const { size } = props;
  let s = `${size}`;
  s = `${s.replace('px', '')}px`;
  return {
    width: s,
    height: s,
  };
}) 
</script>

<style lang="scss" scoped>
svg{
  fill: #333; 
}
</style>